<%#
 Copyright 2020 lwz322 <lwz322@qq.com>
 Licensed to the public under the MIT License.
-%>

<%
local dsp = require "luci.dispatcher"
-%>

<fieldset class="cbi-section">
	<p id="frps_status">
		<em><%:Collecting data...%></em>
	</p>
</fieldset>

<script type="text/javascript">//<![CDATA[
	XHR.poll(5, '<%=dsp.build_url("admin/services/frps/status")%>', null,
		function (x, data) {
			if (x.status !== 200 || !data) {
				return;
			}

			var frpsStatusElm = document.getElementById('frps_status');
			frpsStatusElm.innerHTML = data.running
				? '<%:Running%>'
				: '<%:Not Running%>';
		}
	);
//]]></script>
